// components/navigation-bar/index.js
Component({
  properties: {
    back: Boolean,
    delta: {
      type: Number,
      value: 1
    }
  },
  options: {
    addGlobalClass: true,
    // 注意使用多插槽得先配置
    multipleSlots: true
  },
  externalClasses: ['custom-class', 'title-class'],
  data: {
    message: '老韩不困'
  },
  // 生命周期
  lifetimes: {
    created() {
      console.log('我是created');
      console.log('老韩永不睡觉');
      // created中不能修改数据
      // this.setData({
      //   message: '你也别困'
      // })
    },
    async attached() {
      // 类似于vue里的mounted
      console.log('我是attached');
      this.setData({
        message: '你也别困'
      })
      const systemInfo = await wx.getSystemInfo()
      console.log('你的手机是'+ systemInfo.model);
    }
  },
  // 组件里方法写在methods中
  methods: {
    goBackFn() {
      wx.navigateBack({
        delta: this.data.delta
      })
    }
  }
})
